<style type="text/css">
	.layui-form-item{margin-bottom:0px;}
	.layui-form-pane .layui-form-label {
		width: auto;
	}
</style>
<div class="fixed-bar">
        <form class="layui-form layui-form-pane" action="{:url()}" method="get" id="hisi-table-search">
        <div class="layui-form-item">
	        
	        <div class="layui-inline">
	        	<label class="layui-form-label">订单号</label>
	            <div class="layui-input-inline">
	                <input type="text" name="client_ordernum" lay-verify="" placeholder="输入订单号" class="layui-input">
	            </div>
	        </div>
            {if env('env_site') == 'riwei' }
            <div class="layui-inline">
                <label class="layui-form-label">客户单号</label>
                <div class="layui-input-inline">
                    <input type="text" name="ext_id" lay-verify="" placeholder="输入客户单号" class="layui-input">
                </div>
            </div>
            {/if}
	         <div class="layui-inline removeStat">
                <label class="layui-form-label">完成时间</label>
                <div class="layui-input-inline time_input">
                  <input type="text" name="update_time" readonly="" id="update_time" lay-verify="" placeholder="选择完成时间" class="layui-input">
                </div>
            </div>
            <div class="layui-inline removeStat">
                <label class="layui-form-label">出库类型</label>
                <div class="layui-input-inline">
                    {:Form::select('ct_type', '', $ct_type, '', '')}
                </div>
            </div>
            <div class="layui-inline removeStat">
                <label class="layui-form-label">采购批号</label>
                <div class="layui-input-inline time_input">
                    <input type="text" name="caigou_number" lay-verify="" placeholder="输入采购批号" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">出库工厂</label>
                <div class="layui-input-inline">
                    {:Form::select('factory_id', '', $factoryKV, '', '')}
                </div>
            </div>
	        <div class="layui-inline">
	        	<button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">搜索</button>
                <button type="button" class="layui-btn layui-btn-primary hisi-export">导出</button>
	        </div>
        </div>
        </form>
</div>

<table id="dataTable"></table>

{include file="system@block/layui" /}


<script type="text/html" id="btnTpl">
    {{# if(d.ct_type === 1){ }}
        <a href="{:url('detail')}?id={{ d.id }}" class="hisi-iframe layui-btn layui-btn-primary layui-btn-sm" hisi-data="{width: '1100px', height: '600px'}" title="辅料出库清单">出库清单</a>
    {{# } else{ }}
        <a href="{:url('batchDetail')}?id={{ d.id }}&action={{# if(d.ct_type === 2){ }}checkoutManage{{# } else{ }}fabricsCheckouts{{# } }}"
		 class="hisi-iframe layui-btn layui-btn-primary layui-btn-sm" hisi-data="{width: '1100px', height: '400px'}" title="{{# if(d.ct_type === 2){ }}批量{{# } else{ }}占用{{# } }}出库清单">出库清单</a>
    {{# } }}
</script>
<script type="text/html" id="updateTimeTpl">
    <div>{{layui.util.toDateString(d.update_time * 1000) }}</div>
</script>

<script type="text/javascript">
    layui.use(['table','laydate','jquery','tool','form'], function() {
        var table = layui.table,laydate=layui.laydate,$=layui.jquery;
        laydate.render({
            elem: '#update_time'
            ,range: '~'
            ,theme: 'molv'
            ,mark: {'{:$today}':''}
            ,change: function(value, date, endDate){
              $('#update_time').val(value);
            	$('#layui-laydate1').remove();//关闭面板
            }
        });
        table.render({
            elem: '#dataTable'
            ,url: '{:url()}' //数据接口
            ,page: true //开启分页
            ,skin: 'row'
            ,even: true
            ,limit: 20
            ,limits: [20,50,100,150,200]
            ,text: {
                none : '暂无相关数据'
            }
            ,toolbar: true
            ,defaultToolbar: ['filter', 'exports', 'print']
            ,cols: [[ //表头
                {field: 'id', title: '编号'}
                ,{field: 'action_text', title: '出库类型'}
                ,{field: 'factory_name', title: '出库工厂'}
                ,{field: 'client_ordernum', title: '使用订单号',templet:function(d){return '<span class="copy-item">'+d.client_ordernum+'</span>'}}
                ,{field: 'caigou_number', title: '采购批号'}
				,{field: 'source_ordernum', title: '来源订单号'}
                ,{field: 'update_time', title: '完成时间',templet: '#updateTimeTpl'}
                ,{field: 'btn', title: '操作',templet: '#btnTpl'}
            ]]
        });
    });
</script>